package com.cys.controller;

import com.cys.entity.Goods;
import com.cys.model.service.IGoodsService;
import com.cys.utils.ResultData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.xml.transform.Result;
import java.util.List;

@RestController
@RequestMapping("goods")
@Api("商品模块")
public class GoodController {
    @Autowired
    IGoodsService goodsService;

    @GetMapping
    String a(){
        return "成功";
    }

    @PostMapping
    @ApiOperation("添加商品")
    ResultData save(@RequestBody Goods goods){
        ResultData insert = goodsService.insert(goods);
        return insert;
    }
    //192.168.1.14
    //APS-gO3ZMAl7kVtLnc4dj9wWvcnnjRYFPwac

    @GetMapping("/test")
    String test(){
        int num = 10;
        for (int i = 0; i < num; i++) {
            System.out.println(i);
        }
        return "kankan";
    }

    @GetMapping("/test")
    String shouInfo(){
        System.out.println("哈哈哈");
        return "xixixi";
    }
//    @RequestMapping
//    @ApiOperation("'哈基哈基")
//    public List<Goods> selectAll(){
//        System.out.println("2222");
//        return goodsService.List();
//
//
//    }

    @PostMapping
    @ApiOperation("添加商品3")
    ResultData save1(@RequestBody Goods goods){
        ResultData insert = goodsService.insert(goods);
        return insert;
    }
}
